package com.guangyuan.network.mvc.handler;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.Template;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;

import com.guangyuan.network.context.WebVelocityContext;
import com.guangyuan.network.external.OperatorFactory;
import com.guangyuan.network.mvc.view.ContextAndTemplate;

public class AddProductGroupHandler extends AbstractHandler {

	private static final String NAME = "addProductGroup.vm";
	
	

	@Override
	public ContextAndTemplate handler(HttpServletRequest request,
			HttpServletResponse response, ServletContext servletContext) {
		
		ContextAndTemplate contextAndTemplate = getContextAndTemplate(NAME, request, response, servletContext);
		System.out.println("dasf");
		if(null != contextAndTemplate) {
			contextAndTemplate.getContext().put("productGroups", OperatorFactory.getProductGroupOper().getGroupPerPage(0));
			return contextAndTemplate;
		}
		
		return null;
	}

	public static String getName() {
		return NAME;
	}
	
	
}
